package robotutils.planning;

import java.io.Serializable;
import java.util.HashMap;

/**
 * A simple wrapper to a HashMap that returns infinity if a match is not
 * found.  This cheaply implements the lookup behavior required by D*.
 */
final class ValueMap<State> extends HashMap<State, Double> implements Serializable {

    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
    public Double get(Object key) {

        @SuppressWarnings("element-type-mismatch")
        Double res = super.get(key);

        if (res == null) {
            return Double.POSITIVE_INFINITY;
        } else {
            return res;
        }
    }
}